import Vue from "vue";
import VueRouter from "vue-router";
import Login from "@/views/Login";
import Register from "@/views/Register";
import Detail from "@/views/Detail";
import Layout from "@/views/Layout";
import Article from "@/views/Article";
import Collect from "@/views/Collect";
import Like from "@/views/Like";
import My from "@/views/My";
Vue.use(VueRouter);

const router = new VueRouter({
  mode: "history",
  linkActiveClass: "active",
  linkExactActiveClass: "active",
  routes: [
    { path: "/login", component: Login },
    { path: "/register", component: Register },
    { path: "/article/:id", component: Detail },
    {
      path: "/",
      component: Layout,
      children: [
        { path: "/", redirect: "/article" },
        { path: "article", component: Article },
        { path: "collect", component: Collect },
        { path: "like", component: Like },
        { path: "my", component: My },
      ],
    },
    { path: "*", redirect: "/" },
  ],
});
export default router;
